{% if horizontal_layout %}

    {% if force_weights or not any_weighted_spans %}
        <table class="eli5-weights-wrapper" style="{{ horizontal_layout_table_styles }}">
            <tr>
                {% for target in expl.targets %}
                    <td style="{{ horizontal_layout_header_styles }}">
                        {% include "target_header.html" with context %}
                    </td>
                {% endfor %}
            </tr>
            <tr>
                {% with w_range = target_weight_range %}
                    {% for target in expl.targets %}
                        <td style="{{ horizontal_layout_td_styles }}">
                            {% if force_weights or not target.weighted_spans %}
                                {% with wts = target.feature_weights %}
                                    {% set in_horizontal_layout = True %}
                                    {% include "weights_table.html" with context %}
                                {% endwith %}
                            {% endif %}
                        </td>
                    {% endfor %}
                {% endwith %}
            </tr>
        </table>
    {% endif %}

    {% for target, rendered_ws, ws_other in targets_with_weighted_spans %}
        {% include "weighted_spans.html" with context %}
    {% endfor %}

{% else %}

    {% for target, rendered_ws, ws_other in targets_with_weighted_spans %}

        {% if force_weights or not target.weighted_spans %}
            {% with wts = target.feature_weights %}
                {% set w_range = target_weight_range %}
                {% include "weights_table.html" with context %}
            {% endwith %}
        {% endif %}

        {% include "weighted_spans.html" with context %}

    {% endfor %}
{% endif %}
